package shuati.chuanzhibei.juesai;

import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * @Date : 2023-04-09
 * @Description:
 */
public class BBBBBB {
    static int xend;
    static int yend;
    static  int n;
    static int res;//步数
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
    static List<PII> g = new ArrayList<>();  //位置
    static HashMap<PII, Integer> d = new HashMap<>(); //距离
    public static void main(String[] args) throws IOException {
        String[] split = br.readLine().split("\\s+");
         n=Integer.parseInt(split[0]);
         xend=Integer.parseInt(split[1]);
         yend=Integer.parseInt(split[2]);
        while(n--!=0){
            String[] splits = br.readLine().split("\\s+");
            int x=Integer.parseInt(splits[0]);
            int y=Integer.parseInt(splits[1]);
            g.add(new PII(x,y));
        }
        System.out.println(bfs());
    }
    static int bfs() {
            PII pii = g.get(0);
            if(pii.x==xend&&pii.y==yend) return res;

            //移动方块
            while (g.get(0).y!=yend){
                int a=0,b=0;
                if(g.get(0).y>yend)  b= g.get(0).y-1;
                if(g.get(0).y<yend) b=g.get(0).y+1;
                yidong(g.get(0).x,b,0);
            }
            while (g.get(0).x!=xend){
                int a=0,b=0;
                //如果最里层的不能移动移动外面的
                if(g.get(0).x>xend)  a= g.get(0).x-1;
                if(g.get(0).x<xend) a=g.get(0).x+1;
                yidong(a,g.get(0).y,0);
            }
            return res;
        }


    static void yidong(int a, int b,int x) {
        if(x==n-1) {
            res++;
            g.set(n,new PII(a,b));
            return;
        }
        PII pii1 = g.get(x + 1);
        //如果最里层的不能移动移动外面的
        if(pii1.x<= a&&(pii1.x+x+2)>=a&&pii1.y>=b&&(pii1.y-x-2)<=b) {
            g.set(x,new PII(a,b));
            res++;
            return;
        }
        else yidong(a,b,x+1);
    }
    static class PII {
        int x;
        int y;
        public PII(int x,int y){
            this.x=x;
            this.y=y;
        }
    }
    }

